<?php
/**
 * Arrow container
 *
 * @version 1.0
 * @license  GNU GPL
 * @author Artur Kmera <artur.kmera@arrowplatform.org>
 */
class ArrowContainer{

	/**
	 * Cointainer name
	 *
	 * @var String
	 */
	private $name = "Default Cointainer";

	/**
	 * Is aut needed
	 *
	 * @var boolean
	 */
	private $auth = false;

	/**
	 * If auth needed you must have login template
	 *
	 * @var String
	 */
	private $loginTemplate = false;

	/**
	 * Perrmision deny template
	 *
	 * @var String
	 */
	private $permissionDenyTemplate = false;
	
	/**
	 *	Error template
	 * 
	 * @var unknown_type
	 */
	private $errorTemplate = false ;

	/**
	 * For template system - do we need force compile
	 *
	 * @var boolean
	 */
	private $forceCompile = true;

	/**
	 * For template system - do we need to cache template
	 *
	 * @var boolean
	 */
	private $casching = false;

	/**
	 * For template system - how long we keep template in cache
	 *
	 * @var Integer
	 */
	private $cachingTime = 0;


	/**
	 * Constructor
	 *
	 * @param Array $confArray
	 */
	public function __construct( $confArray ){
		$this->name = (string) $confArray["name"];
		$this->auth = (boolean)  $confArray["auth"];
		$this->loginTemplate = (string) $confArray["loginTemplate"];
		$this->permissionDenyTemplate = (string) $confArray["permissionDenyTemplate"];
		$this->forceCompile = (boolean) $confArray["forceCompile"];
		$this->caching = (boolean)$confArray["caching"];
		$this->cachingTime = (int)$confArray["cachingTime"];
		$this->errorTemplate = (string) $confArray["errorTemplate"] ;

	}

	public function getName(){
		return $this->name;
	}

	public function isAuthProtected(){
		return $this->auth;
	}
	
	public function getForceCompile(){
		if(SUPER_CACHE)
			return false;
		return $this->forceCompile;
	}

	/**
	 * tymczasowo zeby nie robic getterow i seterow
	 * //TODO  wycofac dynamiczne settery
	 */
	public function __call($method, $arguments) {
		
		$prefix = substr($method, 0, 3);
		$property = strtolower(substr($method, 3, 1)).substr($method, 4);

		if ($prefix == "get" && isset($this->$property)) {
			return $this->$property;
		}

		if ($prefix == "set") {
			$this->$property = $arguments[0];
		}
	}




}
?>